<template>
	<view class="container">
		<u-toast ref="uToast" />
		<u-navbar :is-back="true" title="通知详情" back-icon-color='#333333' height="50" :border-bottom="false">
		</u-navbar>
		<view class="list">
			<view class="notify_content">
				{{notifyList.text}}
			</view>
			<view class="school_notify">
				<text>{{notifyList.title}}</text>
				<text>{{notifyList.level}}</text>
				<text>{{notifyList.create_time}}</text>
			</view>
			<view class="picture"
				style="width: 710rpx; margin-left: 20rpx;border-bottom: 1px solid #F2F2F2; height: 500rpx;">
				<image :src="notifyList.pics" mode="widthFix"></image>
			</view>
			<view class="read">
				<text>{{read}}</text>
				<text>{{notifyList.read_count}}</text>
				<image :src="like" mode="widthFix"></image>
				<text>{{notifyList.like_count}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '../../request.js'
	export default {
		data() {
			return {
				content: '根据教育部通知下发文件关于2020年中秋节放假通知具体通知如下',
				announcement: '学校通知',
				importance: '重要',
				start_date: '2020.11.23',
				start_time: '12:00:00',
				background_url: '../../static/tupian78.png',
				read_quantity: 900,
				read: '阅读量:',
				like: '../../static/tupian106.png',
				like_quantity: '300',
				notify_id: 24,
				notify_list: {},
			}
		},
		onLoad(option) {
			if (option) {
				this.notify_id = option.id;
			}
			this.notifyDetail();
		},
		computed: {
			notifyList() {
				if (this.notify_list) {
					return this.notify_list;
				} else {
					return {};
				}
			}
		},
		methods: {
			notifyDetail() {
				let base_url = uni.getStorageSync('host');
				console.log(base_url);
				let _this = this;
				request({
					url: base_url + 'teacher/schoolNotify/detail',
					method: 'post',
					data: {
						school_notify_id: this.notify_id,
					},
					success(res) {
						if (res.statusCode == 200) {
							console.log(res.data.data);
							_this.notify_list = res.data.data;
						} else {
							_this.$refs.uToast.show({
								title: res.data.message || '系统错误',
								type: 'warning',
							})
						}

					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.container {
		width: 100%;
		overflow: hidden;
		background-color: #F2F2F2;

		.list {
			width: 100%;
			background-color: #fff;
			margin-top: 20rpx;
			overflow: hidden;

			.notify_content {
				width: 710rpx;
				color: #333333;
				font-size: 30rpx;
				margin-left: 20rpx;
				margin-top: 31rpx;

			}

			.school_notify {
				width: 710rpx;
				margin-left: 20rpx;
				margin-top: 22rpx;
				height: 40rpx;
				display: flex;
				justify-content: flex-start;
				align-items: center;

				text {
					&:nth-child(1) {
						color: #333333;
						font-size: 24rpx;
					}

					&:nth-child(2) {
						margin-left: 15rpx;
						width: 60rpx;
						height: 40rpx;
						background-color: #ffa100;
						text-align: center;
						line-height: 40rpx;
						border-radius: 8rpx;
						color: #fff;
						font-size: 18rpx;
					}

					&:nth-child(3) {
						margin-left: 30rpx;
						color: #333333;
						font-size: 24rpx;
					}

					&:nth-child(4) {
						margin-left: 20rpx;
						color: #333333;
						font-size: 24rpx;
					}
				}
			}

			.read {
				width: 710rpx;
				height: 50rpx;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				margin-left: 20rpx;
				margin-top: 30rpx;

				text {
					font-size: 24rpx;
					color: #333333;

					&:nth-child(1) {}

					&:nth-child(2) {
						margin-left: 20rpx;
					}

					&:nth-child(4) {
						color: #666666;
						margin-left: 10rpx;
					}
				}

				image {
					&:nth-child(3) {
						width: 30rpx;
						margin-left: 480rpx;
					}
				}
			}
		}

	}
</style>
